I’m new to c++. can anyone help me in the following function [migrated]

Posted by Laian Alsabbagh on Programmers See other posts from Programmers or by Laian Alsabbagh
Published on 2012-10-30T20:54:11Z Indexed on 2012/10/30 23:19 UTC
Read the original article Hit count: 79

Filed under:
|

In this code I’m using a function Distance{to calculate the distance between two nodes } I declare the function like this :

int Distance( int  x1 , int  y1 ,int  x2 , y2){ 
    int  distance_x = x1-x2;  int  distance_y = y1- y2; 
    int  distance =sqrt( (distance_x * distance_x) + (distance_y * distance_y));
    return distance ; 
}

and in the main memory I have 2 for loops what iam asking for ,can I pass the values like this?? Distance (i, j , i+1 ,j+1)

for(int i=0;i< No_Max;i++)
{
  for(int j=0;j<No_Max;j++)
  {
    if( Distance (i, j , i+1 ,j+1)<=Radio_Range)//the function 
      node_degree[i]=node_degree[i]+1;
    cout<<node_degree[i]<<endl;
  }  
}

© Programmers or respective owner

Related posts about c++

Related posts about c